﻿
using Acr.UserDialogs;

using Cashbook.ViewModels;
using Xamarin.Forms;

namespace Cashbook.Views
{
    public partial class BillPage : ContentPage
    {
		public BillsListVM billsListVM;
		public BillPage()
		{
			InitializeComponent();
            billsListVM = new BillsListVM(false, this.Navigation, UserDialogs.Instance);

			this.BindingContext = billsListVM;

		}
		protected override void OnAppearing()
		{
			base.OnAppearing();

			if (billsListVM.Bills.Count == 0)
				billsListVM.LoadBillsCommand.Execute(null);
		}

        void Handle_ItemTapped(object sender, Xamarin.Forms.ItemTappedEventArgs e)
        {
			if (e.Item == null) return;
			// do something with e.SelectedItem
			((ListView)sender).SelectedItem = null; // de-select the row

		}
    }
}
